/**
 * IMessageService.java
 * Created at 2018-2-22
 * Created by zhanghailin
 * Copyright (C) 2018 BROADTEXT SOFTWARE, All rights reserved.
 */
package com.broadtext.message.service;

import java.io.IOException;
import java.util.List;

import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;

import com.broadtext.common.exp.DaoException;
import com.broadtext.common.exp.ServiceException;
import com.broadtext.common.service.IEntityService;
import com.broadtext.message.model.SysMessage;

/**
 * <p>ClassName: IMessageService</p>
 * <p>Description: TODO</p>
 * <p>Author: zhanghailin</p>
 * <p>Date: 2018-2-22</p>
 */
public interface IMessageService extends IEntityService<SysMessage>{
    
    
    /**
     * 
     * <p>Description: TODO</p>
     * @param message
     * @throws DaoException
     */
    Long insertMessage(SysMessage message) throws DaoException;
    
    /**
     * 
     * <p>Description: 将告警信息插入message表中，向用户推送告警消息</p>
     * @throws DaoException
     * @throws ServiceException
     */
    void insertAlertMessage() throws DaoException;
    
    
    /**
     * 
     * <p>Description: 结转告警数据，去重，根据时间连续性判断是否为同一告警</p>
     * @throws DaoException
     * @throws ServiceException
     */
    void insertAlertData() throws DaoException;
    
    /**
     * 
     * <p>Description: 查询消息</p>
     * @param receiver
     * @return
     * @throws DaoException
     */
    List<Object> getMessageNotification(String receiver) throws DaoException; 
    
    /**
     * 
     * <p>Description: 绑定用户和app终端id,使用个推推送消息</p>
     * @param loginName
     * @param clientId
     * @throws DaoException
     */
    void bindAppClientId(String loginName, String clientId) throws DaoException;
    
    /**
     * 
     * <p>Description: 解除绑定</p>
     * @param loginName
     * @throws DaoException
     */
    void unBindAppClientId(String loginName,String clientId) throws DaoException;
    
    
    /**
     * 
     * <p>Description: TODO</p>
     * @throws DaoException
     */
    void pushMessage2App() throws DaoException, JsonGenerationException, JsonMappingException, IOException;
    
    /**
     * 
     * <p>Description: 查询消息详情</p>
     * @param pkId
     * @return
     * @throws DaoException
     */
    SysMessage getMessageById(Long pkId) throws DaoException;
    
    /**
     * 
     * <p>Description: 将消息标为已读</p>
     * @param idArray
     * @throws DaoException
     */
    void readMessage(Long[] idArray) throws DaoException;
    
    /**
     * 
     * <p>Description: 将消息标为已读</p>
     * @param idArray
     * @throws DaoException
     */
    void readMessage(Long pkId) throws DaoException;
    
    /**
     * 
     * <p>Description: 将消息标为已读</p>
     * @param idArray
     * @throws DaoException
     */
    void deleteMessage(Long[] idArray) throws DaoException;
    
    /**
     * 
     * <p>Description: 将消息标为已读</p>
     * @param idArray
     * @throws DaoException
     */
    void readAllMessage(String receiver) throws DaoException;
    
    /**
     * 
     * <p>Description: 获取未读消息数量</p>
     * @param receiver
     * @return
     * @throws DaoException
     */
    Long getMessageCount(String receiver) throws DaoException;
}
